#pragma once

#include "Game/Process/RenderProcess.h"
#include "Render/Texture/Picture2DTexture.h"
#include "Render/Texture/RenderTarget.h"
#include "Render/Tradition/RHIRenderPass.h"
#include "Render/Tradition/GraphicsPipeline.h"
#include "Render/Texture/ColorRenderTarget.h"
#include "Render/Texture/CubemapTexture.h"
#include "Render/Texture/DepthRenderTarget.h"
#include "Render/Shader/RHIDescriptor.h"
#include "Render/Tradition/RHIFramebuffer.h"


class HdrProcess : public RenderProcess
{
	DECLARE_PROCESS(HdrProcess)

	struct Ubo
	{
		glm::mat4 proj;
		glm::mat4 model;
	};

	struct Exposure
	{
		float exposure;
		float gamma;
	};

public:

	void UpdateCubemap(const std::string& processName);

public:

	float mExposure;

	float mGamma;

protected:

	virtual void OnInit() override;

	virtual void OnTick(float deltaTime) override;

	virtual void OnResize() override;


	virtual void OnFrameEnd() override;

protected:

	bool mIsDirty;

	std::string mCubemapProcess;

	RefCountPtr<VertexBuffer> mVertexBuffer;

	RefCountPtr<IndexBuffer> mIndexBuffer;

	RefCountPtr<RHIBuffer> mUboBuffer;

	RefCountPtr<RHIBuffer> mExposureBuffer;

	RefCountPtr<RHIDescriptor> mDescriptor;

	DescriptorMask mDescriptorMask;

	RefCountPtr<GraphicsPipeline> mPipeline;
};
